for _ in range(int(input())):
n, k = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
m = max(a)
a = [m - i for i in a]
if k % 2:
print(*a)
else:
m = max(a)
a = [m - i for i in a]
print(*a)
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define pll pair<ll, ll>
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll i, t, n, k;
cin>>t;
while (t--){
cin>>n>>k;
ll a[n+1], mx = LLONG_MIN;
for (i = 1; i<=n; i++){
cin>>a[i];
mx = max(mx, a[i]);
}
if (k%2==0){
ll mn = LLONG_MIN;
for (i = 1; i<=n; i++){
a[i] = mx - a[i];
mn = max(mn, a[i]);
}
for (i = 1; i<=n; i++){
cout<<mn-a[i]<<' ';
}
}
else {
for (i = 1; i<=n; i++){
cout<<mx-a[i]<<' ';
}
}
cout<<endl;
}
}
1613B - Absent Remainder | 1536B - Prinzessin der Verurteilung |
1699B - Almost Ternary Matrix | 1545A - AquaMoon and Strange Sort |
538B - Quasi Binary | 424A - Squats |
1703A - YES or YES | 494A - Treasure |
48B - Land Lot | 835A - Key races |
1622C - Set or Decrease | 1682A - Palindromic Indices |
903C - Boxes Packing | 887A - Div 64 |
755B - PolandBall and Game | 808B - Average Sleep Time |
1515E - Phoenix and Computers | 1552B - Running for Gold |
994A - Fingerprints | 1221C - Perfect Team |
1709C - Recover an RBS | 378A - Playing with Dice |
248B - Chilly Willy | 1709B - Also Try Minecraft |
1418A - Buying Torches | 131C - The World is a Theatre |
1696A - NIT orz | 1178D - Prime Graph |
1711D - Rain | 534A - Exam |